<template>
    <div class="success-container">
      <h1>Success!</h1>
    </div>
  </template>
  
  <script>
  export default {
    name: 'SuccessPage',
    mounted() {
    // 页面加载后，等待2秒后跳转到'/home'
    setTimeout(() => {
      const username = localStorage.getItem('username'); // 获取用户名
      if (username) {
        this.$router.push({ path: '/home', query: { username } });
      } else {
        this.$router.push('/login'); // 若无用户名，则跳转登录页
      }
    }, 2000);
  }
  }
  </script>
  
  <style scoped>
  .success-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f2f5;
  }
  
  h1 {
    font-size: 48px;
    color: #52c41a;
    text-align: center;
    animation: fadeIn 0.5s ease-in;
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(-20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  </style>